import { h } from 'vue'
import {callConfirmMethod} from '@/common/layer-com-utils.js'
import orderRefund from '@/components/layer-components/order-refund/order-refund.vue'

/**
 * 发起退款操作
 * @param {object} serverData - 当前需要操作的订单列表详细数据 
 */
export function layerOrderRefund(serverData){
    console.log(serverData)
    let confirmMethod=[];
    layer.open({
        title:`发起退款`,
        type:1,
        area:[`500px`,`550px`],
        content:h(orderRefund,{
            serverData,
            callback:(arrayFn)=>confirmMethod=arrayFn
        }), 
        appContext:getApp().$vm.$.appContext,
        shade: true, 
        shadeClose:false,
        btn: [{
            text:`发起退款`, 
            callback: (layerId) =>callConfirmMethod.call(this,confirmMethod[0],layerId)
        },{
            text:`取消关闭`, 
            callback: (layerId) =>callConfirmMethod.call(this,confirmMethod[1],layerId)
        }]
    })
}